Relational and object-relational database management systems store information in tables of rows in a database. To retrieve data, queries that request data are submitted to a database server, which computes the queries and returns the data requested.
Query statements submitted to the database server should conform to the syntactical rules of a particular query language. One popular query language, known as the Structured Query Language (SQL), provides users a variety of ways to specify information to be retrieved.
A query submitted to a database server is evaluated by a query optimizer. Based on the evaluation, the query optimizer generates an execution plan that defines operations for executing the query. Typically, the query optimizer generates an execution plan optimized for efficient execution.
When a query optimizer evaluates a query, it determines various “candidate execution plans” and selects an optimal execution plan. The query may be transformed into one or more semantically equivalent queries. For the query and the one or more of transformed queries, various candidate execution plans are generated.
In general, a query optimizer generates optimized execution plans when the query optimizer is able to perform more kinds transformations under more kinds of conditions. Based on the foregoing, there is clearly a need for more ways of transforming queries.
The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.